package com.mujin.keji.collectionsystem.module.protectionrules.viewmodel;

import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.ViewModel;

import com.mujin.keji.collectionsystem.base.BaseDto;
import com.mujin.keji.collectionsystem.module.protectionrules.dto.OutRuleDto;
import com.mujin.keji.collectionsystem.module.protectionrules.repository.IOutRuleRepository;
import com.mujin.keji.collectionsystem.module.protectionrules.repository.OutRuleRepository;
import com.mujin.keji.collectionsystem.module.protectionrules.vo.OutRuleVo;

/**
 * 外访守则viewmodel
 *
 * @author weishixiong
 * @Time 2018-05-17
 */

public class OutRuleViewModel extends ViewModel {
    private LiveData<BaseDto<OutRuleDto>> liveData;
    private IOutRuleRepository outRuleRepository;

    public LiveData<BaseDto<OutRuleDto>> getLiveData() {
        getOutRule();
        return liveData;
    }

    /**
     * 获取外访守则
     */
    public void getOutRule() {
        outRuleRepository = new OutRuleRepository();
        this.liveData = outRuleRepository.queryOutRule(new OutRuleVo());
    }
}
